
#include"ProcessBar.h"

#define NUM 100 
#define CHAR '='

void ProcessBar(double cur,double tatal)
{
    char nums[NUM] = { 0 }; 
    const char* str = "|/-\\"; 

    int len = strlen(str);
    static size_t cnt = 0;
    double rate = cur * 100 / tatal;

    for(int i = 0;i < rate;i++) nums[i] = CHAR;

    printf("[%-100s][%.2lf%%][%c]\r",nums,rate,str[cnt++ % len]);
    fflush(stdout);
}
